package com.haierp.controller;


import java.util.Set;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.haierp.service.xiaohongshu.IXiaohongshuService;
import com.haierp.util.JsonResult;
import com.wangzhixuan.commons.base.BaseController;

/**
 * 
 * @author wangkan
 *
 */
@Controller
@RequestMapping("/xhs")
public class XhsController extends BaseController {

	@Autowired
	private IXiaohongshuService xiaohongshuService;

	@RequestMapping(value = "/test")
	@ResponseBody
	public Object test(String type) throws Exception {
		JsonResult<String> jsonResult = new JsonResult<>();
		Set<String> spuIdSet = xiaohongshuService.querySpuId(type);
		xiaohongshuService.querySpu(spuIdSet,type);
		return jsonResult.buildIsSuccess(true);
	}

	@RequestMapping(value = "/addItemByTime")
	@ResponseBody
		public Object addItemByTime(String updateStart,String updateEnd, String type) throws Exception {
		updateStart = updateStart+" 00:00:00";
		updateEnd = updateEnd+" 23:59:59";
		JsonResult<String> jsonResult = new JsonResult<>();
		Set<String> spuIdSet = xiaohongshuService.querySpuIdByTime(updateStart,updateEnd,type);
		xiaohongshuService.querySpu(spuIdSet,type);
		return jsonResult.buildIsSuccess(true);
	}
	

}
